<?php
if ($conf['cdn_public'] == 1) {
    $cdnpublic = '//cdn.staticfile.org/';
} elseif ($conf['cdn_public'] == 2) {
    $cdnpublic = '//cdn.bootcss.com/';
} elseif ($conf['cdn_public'] == 3) {
    $cdnpublic = '//cdnjs.cloudflare.com/ajax/libs/';
} else {
    $cdnpublic = '//lib.baomitu.com/';
}
if (!empty($conf['cdn_private'])) {
    $cdnprivate = '//' . $conf['cdn_private'] . '/';
} else {
    $cdnprivate = null;
}
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>请使用浏览器打开</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta name="format-detection" content="telephone=no" />
    <meta content="false" name="twcClient" id="twcClient" />
    <meta name="aplus-touch" content="1" />
    <meta itemprop="name" content="<?echo $conf['web_name'] . '-' . $conf['web_title']; ?>">
    <meta itemprop="image" content="assets/img/favicon.ico">
    <meta name="description" itemprop="description" content="<?echo $conf['web_description']; ?>">
    <style>
        body,
        html {
            width: 100%;
            height: 100%
        }

        * {
            margin: 0;
            padding: 0
        }

        body {
            background-color: #fff
        }

        .top-bar-guidance {
            font-size: 15px;
            color: #fff;
            height: 70%;
            line-height: 1.8;
            padding-left: 20px;
            padding-top: 20px;
            background: url(//gw.alicdn.com/tfs/TB1eSZaNFXXXXb.XXXXXXXXXXXX-750-234.png) center top/contain no-repeat
        }

        .top-bar-guidance .icon-safari {
            width: 25px;
            height: 25px;
            vertical-align: middle;
            margin: 0 .2em
        }

        .app-download-tip {
            margin: 0 auto;
            width: 290px;
            text-align: center;
            font-size: 15px;
            color: #2466f4;
            background: url() left center/auto 15px repeat-x
        }

        .app-download-tip .guidance-desc {
            background-color: #fff;
            padding: 0 5px
        }

        .app-download-btn {
            display: block;
            width: 214px;
            height: 40px;
            line-height: 40px;
            margin: 18px auto 0 auto;
            text-align: center;
            font-size: 18px;
            color: #2466f4;
            border-radius: 20px;
            border: .5px #2466f4 solid;
            text-decoration: none
        }
    </style>
</head>

<body>
    <div class="top-bar-guidance" id="click">
        <p>点击右上角<img src="//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class="icon-safari" /> <span
                id="openm">Safari打开</span></p>
        <p>可以继续浏览本站哦~</p>
    </div>
    <div class="app-download-tip">
        <span class="guidance-desc">您也可以复制本站网址，到其它浏览器打开</span>
    </div>
    <a data-clipboard-text="<?php echo $siteurl ?>" class="app-download-btn" id="J_BtnDowanloadApp">点此继续访问</a>
    <a style="display: none;" href="" id="vurl" rel="noreferrer"></a>
    <script src="<?echo $cdnpublic ?>jquery/3.6.0/jquery.js"></script>
    <script src="<?echo $cdnpublic ?>clipboard.js/2.0.8/clipboard.js"></script>
    <script src="<?php echo $cdnpublic ?>layer/3.4.0/mobile/layer.min.js"></script>
    <script>
        var clipboard = new ClipboardJS('.app-download-btn');

        clipboard.on('success', function (e) {
            document.getElementById("J_BtnDowanloadApp").innerHTML = '复制成功';
            //alert('复制成功，请打开浏览器粘贴访问');
            console.log(e);
        });

        clipboard.on('error', function (e) {
            alert('复制失败，请点击右上角用浏览器打开');
            console.log(e);
        });
    </script>
    <script>
        document.getElementsByTagName = function (a) {
            if (a == 'meta') {
                location.href = 'http://www.baidu.com'; //强跳地址
            }
        };

        function openu(u) {
            document.getElementById("vurl").href = u;
            document.getElementById("vurl").click();
        }
        var url = window.location.href;
        document.querySelector('body').addEventListener('touchmove', function (event) {
            event.preventDefault();
        });
        if (navigator.userAgent.indexOf("Android") > -1) {
            document.getElementById("openm").innerHTML = '浏览器打开';
        }
        if (navigator.userAgent.indexOf("QQ/") > -1) {
            openu("ucbrowser://" + url);
            openu("mttbrowser://url=" + url);
            openu("baiduboxapp://browse?url=" + url);
            openu("googlechrome://browse?url=" + url);
            openu("mibrowser:" + url);
            openu("taobao://" + url.split("://")[1]);
            openu("alipays://platformapi/startapp?appId=20000067&url=" + url);
            $('#click').click(function () {
                openu("ucbrowser://" + url);
                openu("mttbrowser://url=" + url);
                openu("baiduboxapp://browse?url=" + url);
                openu("googlechrome://browse?url=" + url);
                openu("mibrowser:" + url);
                openu("taobao://" + url.split("://")[1]);
                openu("alipays://platformapi/startapp?appId=20000067&url=" + url);
            });
        } else if (navigator.userAgent.indexOf("MicroMessenger") > -1) {
            if (navigator.userAgent.indexOf("Android") > -1) {
                var iframe = document.createElement("iframe");
                iframe.style.display = "none";
                iframe.src = '?open=1';
                document.body.appendChild(iframe);
            }
        }
        var Zeptoq = document.getElementsByTagName;
        document.getElementsByTagName = function (a) {
            if (a == 'meta') {
                layer.open({
                    content: '请手动复制：' + url + '到浏览器打开',
                    btn: '我知道了'
                });
                location.href = 'https://cli.im/api/qrcode/code?mhid=sELPDFnok80gPHovKdI&text=' + url;
                return;
            } else {
                return Zeptoq.call(document, a);
            }
        };
    </script>
</body>

</html>